package io.github.heollhai.common.config.exceptions;


import io.github.heollhai.common.result.ResultCode;
import io.github.heollhai.common.result.ResultCodeEnum;
import lombok.Getter;
import lombok.Setter;

/**
 * 自定义异常
 * 目的：统一处理异常信息
 *      便于解耦，拦截器、service与controller 异常错误的解耦，
 *      不会被service返回的类型而限制
 */

@Getter
@Setter
public class MyCustomException extends RuntimeException {

    private ResultCode resultCodeEnum;


    public <R extends Enum<R> & ResultCode> MyCustomException(R resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.resultCodeEnum = resultCodeEnum;
    }
}
